package dao.auth.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.auth.Users;

import org.springframework.stereotype.Repository;

import core.base.page.Page;
import core.base.page.PageRequest;
import dao.MyBatisBaseDao;
import dao.auth.UsersDao;

@Repository("auth.UsersDao")
public class UsersDaoImpl extends MyBatisBaseDao implements UsersDao {

	public int deleteById(Long id) {
		return getSqlSessionTemplate().delete("auth.UsersMapper.deleteById", id);
	}

	public Users getById(Long id) {
		return (Users) getSqlSessionTemplate().selectOne("auth.UsersMapper.getById", id);
	}

	public int insert(Users model) {
		return getSqlSessionTemplate().insert("auth.UsersMapper.insert", model);
	}

	public List<Users> queryByProperties(Map filter) {
		return getSqlSessionTemplate().selectList("auth.UsersMapper.queryByProperties", filter);
	}

	public Page<Users> queryForPage(PageRequest<Map> pageReq) {
		return super.queryForPage(pageReq, "auth.UsersMapper.queryForPage");
	}

}
